;; weibo emacs

;;mew init
(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil t)
 
;; Optional setup (Read Mail menu for Emacs 21):
(if (boundp 'read-mail-command)
    (setq read-mail-command 'mew))
 
;; Optional setup (e.g. C-xm for sending a message):
(autoload 'mew-user-agent-compose "mew" nil t)
(if (boundp 'mail-user-agent)
    (setq mail-user-agent 'mew-user-agent))
(if (fboundp 'define-mail-user-agent)
    (define-mail-user-agent
      'mew-user-agent
      'mew-user-agent-compose
      'mew-draft-send-message
      'mew-draft-kill
      'mew-send-hook))

(setq mew-config-alist
      '(
        ;; Default fetch mailbox is IMAP
        (default
         (mailbox-type          imap)
         (proto                 "%")
         (imap-server           "imap.qq.com")
         (imap-user             "565407602@qq.com")
         (name                  "zhang")
         (user                  "565407602")
         (mail-domain           "qq.com")
         (imap-size             0)
         (imap-delete           t)
         (imap-queue-folder     "%queue")
         (imap-trash-folder     "%Trash") ;; This must be in concile with your 
         (smtp-auth-list        ("PLAIN" "LOGIN" "CRAM-MD5"))
         (smtp-user             "565407602@qq.com")
         (smtp-server           "smtp.qq.com")
 
         ;; news group comp.lang.c
        )))

;关闭Emacs启动时提示信息
(setq inhibit-startup-message t)
;不要那个如此大的工具条
(tool-bar-mode -1)
;去掉烦人的警告铃声
(setq visible-bell nil)
;默认目录
(setq default-directory "~/")
;显示时间
(display-time)
;时间使用24小时制
(setq display-time-24hr-format t)
;时间显示包括日期和具体时间
(setq display-time-day-and-date t)
;显示行号
(setq column-number-mode t)
(setq line-number-mode t)
;高亮当前行
(require 'hl-line)
(global-hl-line-mode t)
;; 指针颜色设置为白色
;(set-cursor-color "white")
;; 鼠标颜色设置为白色
;(set-mouse-color "white")
;; 设置背景颜色和字体颜色darkblue,dark表示代亮度
;(set-foreground-color "white")
;(set-background-color "darkgreen")
;;指针不要闪，我得眼睛花了
(blink-cursor-mode -1)
(transient-mark-mode 1)
;记录修改时间
;设置time-stamp的格式，在文章的前八行输入 Time-stamp: <>，则出会动出现修改时间。
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-format
"[%f] 由 %:u 修改，时间 %:04y-%02m-%02d %:a %02H:%02M:%02S"
    time-stamp-active t
    time-stamp-warn-inactive t)
;显示匹配的括号
(show-paren-mode t)
;匹配括号的时候, 不要跳到另一个括号那里
(setq show-paren-style 'parentheses)
;; 让所有 "yes or no" 全部使用 "y or n"
(fset 'yes-or-no-p 'y-or-n-p)
;高亮显示要拷贝的区域
(transient-mark-mode t)
;允许emacs和外部其他程式的粘贴
(setq x-select-enable-clipboard t)
;支持中键粘贴
(setq mouse-yank-at-point t)
;开启语法高亮。
(global-font-lock-mode 1)
;当光标在行尾上下移动的时候，始终保持在行尾。
(setq track-eol t)
;防止删除东西，弄一个超大的kill ring
(setq kill-ring-max 200)
;文字行宽60个英文字母
(setq default-fill-column 60)
;;;;备份策略
;配置备份文档的路径
(setq backup-directory-alist '(("" . "~/.emacs.d/auto-save-list/")))
;不要生成临时文件
;(setq-default make-backup-files nil)
;生成临时文件
(setq-default make-backup-file t)
(setq make-backup-file t)
(setq make-backup-files t)
;启用版本控制，即能够备份多次
(setq version-control t)
;备份最原始的版本两次,即第一次编辑前的文档，和第二次编辑前的文档
(setq kept-old-versions 2)
;备份最新的版本10次，理解同上
(setq kept-new-versions 3)
;删掉不属于以上版本的版本
(setq delete-old-versions t)
;自动存盘
(setq auto-save-mode t)
;击键100次自动保存
(setq auto-save-interval 100)
;改变emacs标题栏的标题
(setq frame-title-format "%b@Leon")
;; 在日历中使用天干地支
(setq chinese-calendar-celestial-stem
      ["甲" "乙" "丙" "丁" "戊" "己" "庚" "辛" "壬" "癸"])
(setq chinese-calendar-terrestrial-branch
      ["子" "丑" "寅" "卯" "辰" "巳" "戊" "未" "申" "酉" "戌" "亥"])
;基督徒的的节日
(setq christian-holidays t)
;;有些可惜，没有中国传统农历，谁能写个扩展elisp包弄一下
(setq general-holidays '((holiday-fixed 1 1 "元旦")
(holiday-fixed 1 2 "腊八节")
(holiday-fixed 1 26 "春节")
(holiday-fixed 3 8 "妇女节")
(holiday-fixed 4 1 "愚人节")
(holiday-fixed 5 1 "劳动节")
(holiday-fixed 6 1 "儿童节")
(holiday-fixed 10 1 "国庆节")
(holiday-fixed 12 25 "圣诞节")
(holiday-fixed 2 9 "元宵节")
(holiday-fixed 4 4 "清明节")
(holiday-fixed 5 28 "端午节")
(holiday-fixed 8 26 "七夕")
(holiday-fixed 9 14 "中秋节")
(holiday-fixed 10 7 "重阳节")
(holiday-float 5 0 2 "母亲节")
(holiday-float 6 0 3 "父亲节")
))
;;在日历中突出标记节日和生日
(setq mark-holidays-in-calendar t)
;; 默认的日记文件
(setq diary-file "~/calendar/diary")
;; 自动显示图片
(auto-image-file-mode)
;;去除ESC提示。
(global-unset-key "\e\e")
(global-unset-key "\C-x\C-u")
;常用命令键绑定，删除缓冲区
(global-set-key [f9] 'kill-buffer)
;Emacs的CONTRL+SPACE键去掉，把MARK SET设置成别的F2键。
(global-set-key [(f2)] 'set-mark-command)
(global-set-key [(control space)] nil)
;设置F11快捷键指定Emacs 的日历系统
(global-set-key [f11] 'calendar)
;防止页面滚动时跳动,可以在靠近屏幕边沿3行时就开始滚动
(setq scroll-margin 1 scroll-conservatively 10000)
;首先指定默认的英文等宽字体
(set-default-font "DejaVu Sans Mono-14")
;中文显示字体，标点显示。
(set-fontset-font (frame-parameter nil 'font)
       'han '("WenQuanYi Zen Hei" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
       'cjk-misc '("WenQuanYi Zen Hei" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
       'kana '("WenQuanYi Zen Hei" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
       'symbol '("WenQuanYi Zen Hei" . "unicode-bmp"))
(require 'linum)
(global-linum-mode t)
;中文的句子就可以被正确识别了
(setq sentence-end "\\([。！？]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")



(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(send-mail-function (quote smtpmail-send-it))
 '(smtpmail-smtp-server "smtp.live.com")
 '(smtpmail-smtp-service 25))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(provide 'init-latpaw)
